import pyautogui
import time

if __name__ == '__main__':
    pre = [0, 0]
    while True:
        x, y = pyautogui.position()
        if x != pre[0] or y != pre[1]:
            print("now position {{x, y}} = {0}, {1}".format(x, y))
            img = pyautogui.screenshot()
            r, g, b = img.getpixel((x, y))
            print("color of this position: {}, {}, {}\n".format(r, g, b))
            pre = [x, y]
        time.sleep(0.5)
